$(function (){
    let stat =$(".filter-list").attr("state");
    if(stat==0){
        let unusedCount =$(".filter-list").attr("unused-count");
        if(unusedCount>0){
            $(".empty").css("display","none")
            $(".unused-li a,.unused-li span").css("color","#FF6700")
        }else{
            $(".empty").css("display","block")
            $(".expired-li a,.expired-li span").css("color","#FF6700")
        }
    }else if(stat==1){
        let usedCount =$(".filter-list").attr("used-count");
        if(usedCount>0){
            $(".empty").css("display","none")
            $(".used-li a,.used-li span").css("color","#FF6700")
        }else{
            $(".empty").css("display","block")
            $(".expired-li a,.expired-li span").css("color","#FF6700")
        }
    }else if(stat==2){
        let expiredCount =$(".filter-list").attr("expired-count");
        if(expiredCount>0){
            $(".empty").css("display","none")
            $(".expired-li a,.expired-li span").css("color","#FF6700")
        }else{
            $(".empty").css("display","block")
            $(".expired-li a,.expired-li span").css("color","#FF6700")
        }
    }


    $(".filter-list li a").on("click",function () {
        let state;
        if("已使用"===$(this).text()){
            state=1;
        }else if("已失效"===$(this).text()){
            state=2
        }else{
            state=0;
        }
        //获取用户信息Id
        let informationId =$(".filter-list").attr("information-id");
        //获取账户Id
        let accountId =$(".body").attr("accountId");
        //获取账户名称
        let accountName =$(".body").attr("accountName");
        //加密
        let aesKeyUtil = new Aes_key_util();
        let encryptedInformationId = aesKeyUtil.encrypt(informationId);
        //转格式 转格式是因为如果有特殊符号直接传给后端会变成空格
        window.location.href="http://localhost:8083/www.xiaomi.com/center?informationId="
            +encodeURIComponent(encryptedInformationId)+"&state="+state+"&menu=5&name="+accountName+"&accountId="+accountId;

    })

})